package com.hksj.em.enums;

import com.hksj.common.core.common.PropertyCodeUnitEnum;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zengke
 * @version 1.0
 * @see PropertyEnum
 * @since 2025/08/18 10:52
 */
public enum PropertyEnum {

    //医气
    CO2_CONTENT("alarmEryanghuatan","mg/m³","二氧化碳"),
    O2_CONETENT("alarmYangqi","mg/m³","氧气"),
    N2_CONETENT("alarmDanqi","mg/m³","氮气"),
    N2O_CONETENT("alarmXiaoqi","mg/m³","笑气"),
    AR_CONETENT("alarmYaqi","mg/m³","氩气"),
    NEGATIVE_PRESSURE_VACUUM_SUCTION_CONTENT("alarmFuyaxiyin","pa","负压真空吸引"),
    COMPRESSED_GAS_CONTENT("alarmYasuokongqi","mg/m³","压缩气体"),
    SYSTEM_FAILURE("jzztXtgz","","系统故障"),
    FIRE_STATUS("xfzt","","消防状态"),
    IT_MALFUNCTION("itdyzt","","IT故障"),

    //空调机组
    TEMPERATURE("actualTemperature", "℃","实际温度"),
    SETTING_TEMPERATURE("settingTemperature", "℃","设置温度"),
    HUMIDITY("actualHumidity", "%rh","实际湿度"),
    SETTING_HUMIDITY("settingHumidity", "%rh","设置湿度"),
    PRESSURE("actualPressure","pa","实际压差"),
    KTKGZT("airConditionStatus","","空调开关状态"),


    //灯光
    DENGDAI1("light1","","灯带1"),
    DENGDAI2("light2","","灯带2"),
    ;


    private String code;

    private String value;

    private String name;

    PropertyEnum(String code, String value,String name) {
        this.code = code;
        this.value = value;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static List<String> getAllCode(){
        return Arrays.stream(PropertyCodeUnitEnum.values()).map(PropertyCodeUnitEnum::getCode).collect(Collectors.toList());
    }


    public static String getVal(String code){
        for (PropertyEnum modelCodeEnum : PropertyEnum.values()) {
            if (modelCodeEnum.code.equals(code)){
                return modelCodeEnum.value;
            }
        }
        return null;
    }

    public static String getName(String code){
        for (PropertyEnum modelCodeEnum : PropertyEnum.values()) {
            if (modelCodeEnum.code.equals(code)){
                return modelCodeEnum.name;
            }
        }
        return null;
    }
}
